package com.mdx.zhizhao.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdx.zhizhao.domain.Deliver;

import com.mdx.zhizhao.persistence.DeliverMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeliverService {
    @Autowired
    private DeliverMapper deliverMapper;
    public void upateDeliver(Deliver deliver) {
             QueryWrapper<Deliver> queryWrapper = new QueryWrapper<Deliver>();
         queryWrapper.eq("seekerid", deliver.getSeekerid())
                 .eq("enterpriseid", deliver.getEnterpriseid())
                 .eq("jobid", deliver.getJobid());
        deliverMapper.update(deliver,queryWrapper);
    }
    public void  insertDeliver(Deliver deliver) {
        deliverMapper.insert(deliver);
    }
    public List<Deliver> selectDeliverBySeeker(String seekerid) {
          QueryWrapper<Deliver> queryWrapper = new QueryWrapper<Deliver>();
         queryWrapper.eq("seekerid", seekerid);
         List<Deliver> delivers = deliverMapper.selectList(queryWrapper);
         return delivers;
    }
    public List<Deliver> selectDeliverByEnterprise(String enterpriseid) {
        QueryWrapper<Deliver> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enterpriseid", enterpriseid);
        List<Deliver> delivers = deliverMapper.selectList(queryWrapper);
        return delivers;
    }
}
